package tools

import com.github.stuxuhai.jpinyin._

/**
  * Created by Administrator on 2016/1/15.
  */
object PinYin {
  def toPinYin(str:String)={
    if(ChineseHelper.containsChinese(str)) {
      PinyinHelper.convertToPinyinString(str, ",", PinyinFormat.WITHOUT_TONE)
    }else str
  }
  implicit class StrAddMethod[A <: String](data: A) {
    def pinyin = toPinYin(data)
  }

}
